package com.bana.fvs.app.mvp.presenter;

import android.app.Activity;

import com.bana.fvs.app.module.info.entity.ChangePhoneBean;
import com.bana.fvs.app.module.info.entity.UpdatePwdBean;
import com.bana.fvs.app.mvp.contract.ChangePhoneContract;
import com.bana.fvs.app.mvp.model.ChangePhoneModel;
import com.wei.commonlibrary.net.CommException;
import com.wei.commonlibrary.net.MyDefaultCallback;

/**
 * Author : yanftch
 * Date : 2018/3/1
 * Time : 21:46
 * Desc :
 */

public class ChangePhonePresenter extends ChangePhoneContract.AbsChangePhonePresenter {

    @Override
    public void http_changePhone(Activity activity, String token, String telephone) {
        mModel.http_changePhone(token, telephone).callback(new MyDefaultCallback<UpdatePwdBean>(activity, true) {
            @Override
            public void onError(CommException e) {
                if (getView() != null)
                    getView().onError(e);
            }

            @Override
            public void response(UpdatePwdBean updatePwdBean) {
                if (getView() != null)
                    getView().onResponse(updatePwdBean);
            }
        });
    }

    @Override
    protected ChangePhoneContract.AbsChangePhoneModel createModel() {
        return new ChangePhoneModel();
    }
}
